package com.ruoyi.web.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.web.service.WorkEnterpriseService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 企业表 前端控制器
 * </p>
 *
 * @author 
 * @since 2025-03-12
 */
@RestController
@RequestMapping("/work-enterprise")
public class WorkEnterpriseController extends BaseController {

    @Autowired
    private WorkEnterpriseService workEnterpriseService;

    @ApiOperation("检索企业名称")
    @GetMapping("/name")
    public AjaxResult getCompanyName(@RequestParam("companyName") String companyName){
        return AjaxResult.success(workEnterpriseService.getCompanyName(companyName));
    }

    @ApiOperation("根据企业名称查询企业所在地")
    @GetMapping("/area")
    public AjaxResult getAreaByCompanyName(@RequestParam("companyName") String companyName){
        return AjaxResult.success(workEnterpriseService.getAreaByCompanyName(companyName));
    }

    @ApiOperation("根据企业名称查询企业所在地2")
    @GetMapping("/areaInfo")
    public AjaxResult getAreaInfoByCompanyName(@RequestParam("companyName") String companyName){
        return AjaxResult.success(workEnterpriseService.getAreaInfoByCompanyName(companyName));
    }

    @ApiOperation("根据parentCode查询区域")
    @GetMapping("/areaDict")
    public AjaxResult getAreaDictList(@RequestParam("parentCode") String parentCode){
        return AjaxResult.success(workEnterpriseService.getAreaDictList(parentCode));
    }
}
